package demo;

import java.io.Serializable;

public class Person implements Serializable {
    private String name;
    private String address;
    private transient String job;
    private String IDCard;
    private int age;

    public Person(){
        System.out.println("无参构造执行");
    }

    private Person(int age) {
        this.age = age;
        System.out.println("私有有参构造执行,岁数"+age);
    }

    public Person(String name, String address, String job, String IDCard, int age) {
        this.name = name;
        this.address = address;
        this.job = job;
        this.IDCard = IDCard;
        this.age = age;
        System.out.println("有参构造执行"+name);
    }

    private String getName() {
        return name;
    }

    private void setName(String name) {
        this.name = name;
    }

    private String getAddress() {
        return address;
    }

    private void setAddress(String address) {
        this.address = address;
    }

    private String getJob() {
        return job;
    }

    private void setJob(String job) {
        this.job = job;
    }

    private String getIDCard() {
        return IDCard;
    }

    private void setIDCard(String IDCard) {
        this.IDCard = IDCard;
    }

    public int getAge() {
        System.out.println("方法getAge执行了");
        return age;
    }

    private void setAge(int age) {
        System.out.println("方法setAge执行了");
        this.age = age;
    }

    private void sayHi(){
        System.out.println("大家好,我是"+name);
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", address='" + address + '\'' +
                ", job='" + job + '\'' +
                ", IDCard='" + IDCard + '\'' +
                ", age=" + age +
                '}';
    }
}
